<? 
session_start();
if(!session_is_registered(uid)){
    echo "You have to login to view this page!</br></br>";
    echo "Click here to return to the "; 
    echo '<a href="./../index.php" title="Login">Login Page</a></br></br>';
    echo "Or sign up using this link ";
    echo '<a href="./../Registration/registration.html" title="Registration">Registration Page</a>';
exit();
}
 else {

    //Manual SQL Connection
    $con = mysql_connect("localhost", "root", "root") or die ( "Error connectiong to DB: ".mysql_error());
       
    mysql_select_db("reeferslog", $con) or die ( "Error selecting specific DB, reefeerslog: ".mysql_error());

    
    $qry = "select * from users where user_id='".$_SESSION['uid']."'";
    
    $results = mysql_query($qry)or die(mysql_error($con));

    extract(mysql_fetch_assoc($results));
 }
?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>User Profile</title>
        <link rel="stylesheet" type="text/css" href="http://localhost/ReefersLogApp/CSS/Generalpagelayout.css" />
    
    <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'></script>
    <script type='text/javascript' src='./../scripts/js/jquery.ba-hashchange.min.js'></script>
    <script type='text/javascript' src='./../scripts/js/dynamicpage.js'></script>

    </head>
    <div id="container">
	<div id="header">
            <h1>
		Reefers Log
            </h1>
	</div>
	<div id="navigation">
		<ul>
			<li><a href="./../WelcomePage/WelcomePage.php">Home</a></li>
			<li><a href="./../Profile/userprofile.php">Profile</a></li>
			<li><a href="./../Tools/tools.php">Tools</a></li>
			<li><a href="./../Logout/logout.php">Logout</a></li>
		</ul>
	</div>
	<div id="content-container">
		<div id="section-navigation">
                    <object id="loader" name="frameloader" type="text/html" data="http://localhost/ReefersLogApp/Welcome/WelcomePage.php/"></object>
			<ul>
                           
                                <li><a href="./../Tank/tank.html">Tank</a></li>
				<li><a href="./../Equipment/equip.html">Equipment</a></li>
				<li><a href="./../Test_Logs/watertest.html">Water Tests</a></li>				
                                <li><a href="./../Maintenance/maintenance.html">Maintenance</a></li>
				
			</ul>
		</div>
		<div id="content">
                    <h2>
                        Your Aquarium Statistics:
                    </h2>
                    <p>
                        Modify your user profile and save the results.
                    </p>
		</div>
            <div id="content">
                    <h2>
                        User Profile:
                    </h2>
                <form name="Profile" action="updateprofile.php?action=<?php echo $_GET['uid']?> method="post">
                <table border="1">
                    
                    <tbody>
                        <tr>
                            <td><label> First name:</label>   <input type="text" name="fname" value="<? echo $fname?>" /></td>
                            <td><label>Last name:</label>        <input type="text" name="lname" value="<? echo $lname?>" /></td>
                        </tr>
                        <tr>
                            <td><label>Password:</label>             <input type="password" name="password" value="<? echo $password?>" /> </td>
                            <td><label>Email:</label>         <input type="text" name="email" value="<? echo $email?>" /></td>                                      
                    </tbody>

                </table>           
                    <input align="center" type="submit" value="Save" />
                    
      
                </form>             
		</div>                   
		<div id="aside">
                    <h3>
                        Info:
                    </h3>
                    <p>You may update your user profile by completing the fields in the form on the left.</p>
		</div>
		<div id="footer">
			Copyright © ReefersLog, 2012, wkoester All Rights Reserved
		</div>
	</div>
</div>
</html>